package aspectjutil.eventmanager.testmodels;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import aspectjutil.adviseutil.Util;
import aspectjutil.eventmanager.label.EventTrigger;

public class EventProducerByStaticField {
	protected static final Logger logger = LoggerFactory.getLogger( EventProducerByStaticField.class);

	@EventTrigger( value=SampleEventClass.PriceChange.class)
	protected static int price;
	public static final void setPrice(int price) {
		if ( logger.isDebugEnabled()) {
			String thisMethodInfo 
			= Util.getCallingMethodInfo( Thread.currentThread().getStackTrace(), 1, 1).get( 0);
			logger.debug( 
					"Executing" 
					+ (( thisMethodInfo.indexOf( "]:") > 0) ? 
							thisMethodInfo.substring( thisMethodInfo.indexOf( "]:") + 2) : thisMethodInfo)
					);
		}
		
		EventProducerByStaticField.price = price;
	}
}
